package com.fivemin.website_statistics.service.impl;

import com.fivemin.website_statistics.service.StatisticsService;
import com.fivemin.website_statistics.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Service;
import com.fivemin.website_statistics.utils.*;
import javax.servlet.http.HttpServletRequest;

@Service
public class StatisticsServiceImpl implements StatisticsService {

    @Autowired
    private RedisTemplate redisTemplate;

    @Override
    public R statistics(String key, HttpServletRequest httpServletRequest) {
        // 获取请求ip
        String ip = Utils.getIpAddress(httpServletRequest);
        // 获取请求源
        String origin = httpServletRequest.getHeader("Origin");
        // 获取UA
        String ua = httpServletRequest.getHeader("User-Agent");

        String md5 = Utils.MD5(ip + origin + ua);

        ValueOperations valueOperations = redisTemplate.opsForValue();
        valueOperations.
        return null;
    }
}
